import request from '@/config/axios'

export interface CustomerVO {
  id: number
  name: string
  ip: string
  userAgent: string
  clientType: number
  sourceUrl: string
}

// 查询客户列表列表
export const getCustomerPage = async (params) => {
  return await request.get({ url: `/service/customer/page`, params })
}

// 查询客户列表详情
export const getCustomer = async (id: number) => {
  return await request.get({ url: `/service/customer/get?id=` + id })
}

// 新增客户列表
export const createCustomer = async (data: CustomerVO) => {
  return await request.post({ url: `/service/customer/create`, data })
}

// 修改客户列表
export const updateCustomer = async (data: CustomerVO) => {
  return await request.put({ url: `/service/customer/update`, data })
}

// 删除客户列表
export const deleteCustomer = async (id: number) => {
  return await request.delete({ url: `/service/customer/delete?id=` + id })
}

// 导出客户列表 Excel
export const exportCustomer = async (params) => {
  return await request.download({ url: `/service/customer/export-excel`, params })
}

// 获取聊天记录
export const getChatMessage = async (params) => {
  return await request.get({ url: `/service/message/get-chat-message`, params })
}

// 获取客户表单
export const getCustomerForm = async (id) => {
  return await request.get({ url: `/service/step-form-data/get-by-customer?customerId=${id}` })
}
